package cn.ywang.pattern.guava;

import com.google.common.eventbus.EventBus;

/**
 * Guava订阅模式测试
 *
 * @author BeatificWang
 * @date 2019/3/20 23:36
 */
public class GuavaEventTest {
	public static void main(String[] args) {
		Question question = new Question();
		question.setName("wang");
		question.setContent("设计模式的优缺点");
		// 发布者
		EventBus bus = new EventBus();
		GuavaEvent eventA = new GuavaEvent("A");
		bus.register(eventA);
		GuavaEvent eventB = new GuavaEvent("B");
		bus.register(eventB);
		bus.post(question);
	}
}
